$(function () {
    $('.input_sub').on('click', function () {
        let username = $('.input_txt').val()
        let password = $('.input_pass').val()
        $.ajax({
            type: 'post',
            // url: 'http://localhost:8080/api/v1/admin/user/login',
            url: bignews.user_login,
            data: { username, password },
            success: function (res) {
                $('.loginmsg>p').text(res.msg)
                if (res.code === 200) {
                    localStorage.setItem('bignews-token', res.token)
                    $('#tipmodal').modal('show')
                    $('#tipmodal').on('hidden.bs.modal', function () {
                        location.href = './index.html'
                    })

                } else {
                    $('#tipmodal').modal('show')
                }
            },
            dataType: 'json'
        })
    })
    $('.btnhided').on('click', function () {
        $('#tipmodal').modal('hide')
    })
})